<template>
	<view class="container">
		<block v-if="listData.length > 0">
			<block v-for="(item, index) in listData" :key="index">
				<member :item="item" :type="'birthday'"></member>
			</block>
		</block>
		<block v-else>
			<view class="all_empty">
				<u-empty mode="data" text="用户列表为空"></u-empty>
			</view>
		</block>
		<u-loadmore v-if="listData.length > searchForm.limit" :status="status" :loading-text="loadingText" :loadmore-text="loadmoreText" :nomore-text="nomoreText" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				path:'',
				queryForm:{
					limit:10,
					page:1,
					type:''
				},
				listData:[]
			}
		},
		onLoad({path,title,type}) {
			this.path = path
			this.queryForm.type = type
			uni.setNavigationBarTitle({
				title
			})
			this.$initConfig().then(_=>{
				this.getInfo()
			})
		},
		onReachBottom() {
			if (this.status != 'nomore') {
				this.searchForm.page++;
				this.getInfo(true);
			}
		},
		methods: {
			getInfo(is_add = false){
				let _this = this
				_this.$http('crop/getCropByTypeInfo',{
					path:_this.path,
					..._this.queryForm
				}).then(res=>{
					if (res.code) {
						if (is_add) {
							_this.listData = _this.listData.concat(res.data.data);
						} else {
							_this.listData = res.data.data;
						}
						if (_this.listData.length >= res.data.total) {
							this.status = 'nomore';
						} else {
							this.status = 'loadmore';
						}
					}
				})
			}
		}
	}
</script>

<style>

</style>
